# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(
    default_visibility = ["//visibility:private"],
)

cc_library(
    name = "native",
    visibility = ["//visibility:public"],
    deps = [
        ":brush_serialization_jni",
        ":stroke_input_batch_serialization_jni",
    ],
    alwayslink = 1,
)

cc_library(
    name = "stroke_input_batch_serialization_jni",
    srcs = ["stroke_input_batch_serialization_jni.cc"],
    deps = [
        "//ink/jni/internal:jni_defines",
        "//ink/jni/internal:jni_proto_util",
        "//ink/jni/internal:jni_throw_util",
        "//ink/storage:stroke_input_batch",
        "//ink/storage/proto:stroke_input_batch_cc_proto",
        "//ink/strokes/input:stroke_input_batch",
        "//ink/strokes/internal/jni:stroke_input_jni_helper",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/log:check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/types:span",
    ] + select({
        "@platforms//os:android": [],
        "//conditions:default": [
            "@rules_jni//jni",
        ],
    }),
    alwayslink = 1,
)

cc_library(
    name = "brush_serialization_jni",
    srcs = ["brush_serialization_jni.cc"],
    deps = [
        "//ink/brush",
        "//ink/brush:brush_coat",
        "//ink/brush:brush_family",
        "//ink/brush:brush_paint",
        "//ink/brush:brush_tip",
        "//ink/brush/internal/jni:brush_jni_helper",
        "//ink/jni/internal:jni_defines",
        "//ink/jni/internal:jni_jvm_interface",
        "//ink/jni/internal:jni_proto_util",
        "//ink/jni/internal:jni_string_util",
        "//ink/jni/internal:jni_throw_util",
        "//ink/storage:brush",
        "//ink/storage/proto:brush_cc_proto",
        "//ink/storage/proto:brush_family_cc_proto",
        "@com_google_absl//absl/log:absl_check",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
    ] + select({
        "@platforms//os:android": [],
        "//conditions:default": [
            "@rules_jni//jni",
        ],
    }),
    alwayslink = 1,
)
